﻿<?php
/*********************************************************************************
module : vng sales marketing
author : hoanghd@vinagame.com.vn
 ********************************************************************************/
require_once('data/SugarBean.php');

require_once('include/database/PearDatabase.php');
require_once('include/utils.php');
include_once('config.php');
require_once('log4php/LoggerManager.php');
require_once('include/HFunction.php');
require_once('include/HWSPaging.php');

class ZT2Remit extends SugarPaging {
	public $TotalPage;
	public $TotalRecord;
	public $dllPageSize;
	public $PageIndex;
	public $campaign_id;
	public $path_upload;
	public $path_content;
	public $Info;
	public $WS;
     public $_totalRecord ;
        public $_totalPCs;
        public $_totalPlayingTime ;

	var $object_name = 'ZT2Remit';
	var $module_dir  = 'ZT2Remit';
	var $user_name = '';	
	var $theme = 'redmond';
	var $MD5Code = 'FNC';
	var $NumofEmail = 500;
	var $NumofImport = 500;
	var $EmailLimit = 3000;
	var $aclcustom;
	

	function ZT2Remit(){
		global $current_user;
		global $_pslted_code;
		 parent::SugarBean();
		 $this->user_name = $current_user->user_name;
		 $this->path_upload = 'modules/ZT2Remit/upload';
		 $this->path_content = 'modules/ZT2Remit/upload/content';
		 
	}

	function fnc_get_gamecode(){
		$sSQL="exec usp_vng_gamecode_list";
		$result = $this->db->query($sSQL, true, "Query failed");	
		while ($aR1 = $this->db->fetchByAssoc($result))
				{
                                    $arr[$aR1['RecordID']] = $aR1['Item'];
                    
                }
        return $arr;
	}	
    
    
	function location_by_city($parent_id){
		if ($parent_id=='')
			$parent_id = 0 ;
		$sSQL="exec usp_vng_location 1,$parent_id,0,0";
		//echo $sSQL;
		$result = $this->db->query($sSQL, true, "Query failed");								
		$option1 = array();
		$option2 = array();
		$i=0;
		while ($aR = $this->db->fetchByAssoc($result))
			{	
				$ws_loc_id = $aR['id'];
				$ws_loc_name = $aR['name'];
				
				$option1[$ws_loc_id] = $ws_loc_name;
				$option2[$i]['record_id'] = $ws_loc_id;
				$option2[$i]['item'] = $ws_loc_name;				
				$i++;
				
			}
			$option[0] = $option1;
			$option[1] = $option2;
		
		return 	$option;		
	}	

	function location_area($parent_id){
		$sSQL="exec usp_vng_location 0,1,0,0";
		//echo $sSQL;
		$result = $this->db->query($sSQL, true, "Query failed");								
		$option1 = array();
		$option2 = array();
		$i=0;
		while ($aR = $this->db->fetchByAssoc($result))
			{	
				$ws_loc_id = $aR['id'];
				$ws_loc_name = $aR['name'];
				
				$option1[$ws_loc_id] = $ws_loc_name;
				$option2[$i]['record_id'] = $ws_loc_id;
				$option2[$i]['item'] = $ws_loc_name;				
				$i++;
				
			}
			$option[0] = $option1;
			$option[1] = $option2;
		
		return 	$option;		
	}


	function location_by_district($parent_id){
		if ($parent_id=='')
			$parent_id = 0 ;
		$sSQL="exec usp_vng_location 1,$parent_id,0,0";
		//echo $sSQL;
		$result = $this->db->query($sSQL, true, "Query failed");								
		$option1 = array();
		$option2 = array();
		$i=0;
		while ($aR = $this->db->fetchByAssoc($result))
			{	
				$ws_loc_id = $aR['id'];
				$ws_loc_name = $aR['name'];
				
				$option1[$ws_loc_id] = $ws_loc_name;
				$option2[$i]['record_id'] = $ws_loc_id;
				$option2[$i]['item'] = $ws_loc_name;
				$i++;
				
			}
			$option[0] = $option1;
			$option[1] = $option2;
		
		return 	$option;		
	}
    

 }
 

?>
